package com.zmht.beike.biz.impl;

import java.io.Serializable;
import java.util.List;

import com.zmht.beike.biz.IAiminfoBiz;
import com.zmht.beike.core.BaseBizImpl;
import com.zmht.beike.po.TIaiminfo;

public class IAiminfoBizImpl extends BaseBizImpl implements IAiminfoBiz {

	public List getIaiminfo(Integer teacherId, int startIndex, int pageSize) {
		String hql = "from TIaiminfo t where t.teacherId="+teacherId;
		return this.getIaiminfoDAO().findByPage(hql, startIndex, pageSize);
		
	}
	/**
	 * 保存后返回id
	 */
	public Integer saveIaiminfo(TIaiminfo iaiminfo) {
		try{
		return (Integer)this.getIaiminfoDAO().saveObj(iaiminfo);
		}catch(Exception e){
			return 0;
		}
		
	}
	public int getIaiminfoTotal(Integer teacherId) {
		String hql = "from TIaiminfo t where t.teacherId="+teacherId;
		return this.getIaiminfoDAO().findByHQLObj(hql).size();

	}
	public boolean updateIaiminfo(TIaiminfo iaiminfo) {
		try{
				return this.getIaiminfoDAO().updateObj(iaiminfo);
			}catch(Exception e){
				return false;
			}
		
	}
	public TIaiminfo findById(Serializable id) {
		
		return (TIaiminfo)this.getIaiminfoDAO().findById(TIaiminfo.class, id);
	}

}
